﻿@{
    ViewBag.Title = "Statistics";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>Статистика</h2>
  <!-- Add Google Analytics authorization button -->
  <button id="authorize-button" style="visibility: hidden">
        Authorize Analytics</button>

  <!-- Div element where the Line Chart will be placed -->
  <div id='line-chart-example'></div>

  <!-- Load all Google JS libraries -->
  <script src="https://www.google.com/jsapi"></script>
  <script src="../../Scripts/gadash-1.0.js"></script>
  <script src="https://apis.google.com/js/client.js?onload=gadashInit"></script>
  <script>
      // Configure these parameters before you start.
      var API_KEY = 'AIzaSyB_Ji4U_B6fmvJfRxyuZPTSP-HY6Y0R-9U';
      var CLIENT_ID = '417247468256';
      var TABLE_ID = 'ga:53181296';
      // Format of table ID is ga:xxx where xxx is the profile ID.

      gadash.configKeys({
          'apiKey': API_KEY,
          'clientId': CLIENT_ID
      });

      // Create a new Chart that queries visitors for the last 30 days and plots
      // visualizes in a line chart.
      var chart1 = new gadash.Chart({
          'type': 'LineChart',
          'divContainer': 'line-chart-example',
          'last-n-days': 30,
          'query': {
              'ids': TABLE_ID,
              'metrics': 'ga:visitors',
              'dimensions': 'ga:date'
          },
          'chartOptions': {
              height: 600,
              title: 'Visits in January 2011',
              hAxis: { title: 'Date' },
              vAxis: { title: 'Visits' },
              curveType: 'function'
          }
      }).render();
  </script>